<template>
  <div>
    <div class="inline" v-for="(item, index) in arr" :key="index">
      <input v-model="iptArr" type="checkbox" :value="item" /><span>{{
        item
      }}</span>
    </div>
    <h3>你选中的元素累加值为：{{ sum }}</h3>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: [9, 15, 19, 25, 29, 31, 48, 57, 62, 79, 87],
      iptArr: [],
    };
  },
  computed: {
    sum() {
      return this.iptArr.reduce((sum, item) => (sum += item), 0);
    },
  },
};
</script>

<style>
.inline {
  display: inline-block;
  margin: 20px 10px;
}
</style>